Skip to content

Fix removeTestLog and step-log lifecycle; add test plan iteration; align README with v2 API#29

Open
ShubhamMour wants to merge 5 commits into
prodfrom
fix/vansahnode-removetestlog-debug-spacekey
Open

Fix removeTestLog and step-log lifecycle; add test plan iteration; align README with v2 API#29
ShubhamMour wants to merge 5 commits into
prodfrom
fix/vansahnode-removetestlog-debug-spacekey

Conversation

@ShubhamMour

@ShubhamMour ShubhamMour commented Jul 13, 2026

Copy link
Copy Markdown

Summary

This update fixes a broken "remove test log" action and changes how test results are recorded so that deleting or updating a step no longer causes errors. It also lets you target a specific test plan iteration. The README has also been cleaned up so the examples actually work and match how Vansah works today. Everything was checked against the live Vansah environment.

What changed

Removing a test log now works
Previously, trying to remove a test log failed with a "Test Run not found" error because it was pointing at the wrong place. This has been corrected so removal works reliably.

Recording results no longer causes duplicate errors
Adding a result now updates the step's existing log instead of creating a new one, which avoids the "A Test Log already exists for this Step" error. If a test case has no steps, it still creates a log as before.

Steps stay clean after a log is removed
When you remove a step's log, a fresh empty one is put back in its place, so adding a new result later goes to the right spot.

Choose which test plan iteration to record against
Standard and Advanced Test Plan runs now let you pick an iteration. If you do nothing, runs go to iteration 1 exactly as before — so existing setups are unaffected. To target a different iteration, call setTestPlanIteration(n) (where n is 1–5) before creating the run. Values outside 1–5 are ignored with a warning.

Optional debug logging
You can now turn on request logging (via a VANSAH_DEBUG setting) to help troubleshoot issues. Attachments are logged separately so they don't clutter the output.

Clearer "Space Key" wording
Warning messages now say "Space Key" to match the wording used in Vansah.

README improvements

  • Fixed a broken example that wouldn't run.
  • Added documentation for setting the Space Key and turning on debug mode.
  • Added documentation for the new test plan iteration setter.
  • Corrected the list of valid result values (NA / Failed / Passed / Untested).
  • Tidied up the setup and API-token instructions.

- removeTestLog() now calls /api/v2/logs/{id} instead of /api/v2/run/{id};
  it was deleting via the run endpoint with a log identifier, which failed
  with "Test Run not found". Verified against the live v2 API.
- Add optional request-payload logging gated by VANSAH_DEBUG env var (or
  setDebug(true)) to aid diagnosing integration issues; attachments are
  logged after the payload so base64 does not flood the output.
- Warning messages for an invalid/empty project key now say "Space Key"
  to match Vansah's terminology.
- Fix non-existent setter: setTESTFOLDER_PATH -> setFOLDERPATH (the
  documented example did not compile).
- Fix swapped ATP/STP keys in the setter example (ATP KAN-P17, STP KAN-P18).
- Document setProjectKey (Space Key), required for API v2 scoping.
- Document setDebug / VANSAH_DEBUG payload logging.
- Use "Space Key" terminology to match the binding and Vansah UI.
- Correct addTestLog result values (NA/FAILED/PASSED/UNTESTED, not N/A) and
  clarify quick-test result is an int (0-3).
- Tag the dependencies snippet as xml, and reformat the API-token notice.
- All four addTestRun* methods (JIRA issue, test folder, ATP, STP) now send
  result id 3 (UNTESTED) on creation, so Vansah pre-creates one test log per
  step of the test case.
- Capture the per-step logs from the add-test-run response (data.run.logs) into
  a step-number -> log-identifier map (storeStepLogs).
- addTestLog now updates the pre-created step log via PUT /logs/{id} instead of
  posting a new one, which avoids the "A Test Log already exists for provided
  Step" error. Falls back to creating a log when no pre-created log exists for
  the step (e.g. a case with no steps), preserving prior behaviour.

Verified against the live Vansah v2 API; existing test suite passes (18/18).
After removeTestLog deletes a step's log, recreate an empty UNTESTED log for
that step and refresh the step -> log map, so a later addTestLog updates the
correct log and the map never holds a stale (deleted) identifier.

- Add stepForLog(id): reverse lookup of the step for a given log identifier.
- Add recreateUntestedStepLog(step): posts a fresh UNTESTED log for the step
  and stores its new identifier.
- Keep the step -> log map in sync after every addTestLog (update and
  fallback-create paths).

Verified against the live Vansah v2 API; existing test suite passes (18/18).
@ShubhamMour ShubhamMour changed the title Fix removeTestLog endpoint and UNTESTED step-log lifecycle; align README with v2 API Fix test log removal, record results reliably, and update the README Jul 13, 2026
@ShubhamMour ShubhamMour changed the title Fix test log removal, record results reliably, and update the README Fix removeTestLog endpoint and step-log lifecycle; align README with v2 API Jul 13, 2026
Add setTestPlanIteration(int) so Standard/Advanced Test Plan runs can
target an iteration other than the hardcoded 1. Runs default to
iteration 1 when the setter is not called, so existing callers are
unaffected. Valid range is 1-5; out-of-range values are ignored with a
warning. Document the setter and its default in the README.
@ShubhamMour ShubhamMour changed the title Fix removeTestLog endpoint and step-log lifecycle; align README with v2 API Fix removeTestLog and step-log lifecycle; add test plan iteration; align README with v2 API Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant